package com.moody.service;

import java.util.List;
import java.util.Map;

import net.sf.json.JSONArray;

import org.springframework.stereotype.Service;

import com.moody.hibernate.domain.AssociateAccount;
import com.moody.hibernate.domain.BankCustGuarantee;
import com.moody.hibernate.domain.BankCustDeposit;
import com.moody.hibernate.domain.BankCustLoan;
import com.moody.hibernate.domain.CollateralInfo;
import com.moody.hibernate.domain.CustAddress;
import com.moody.hibernate.domain.CustEvents;
import com.moody.hibernate.domain.CustInfo;
import com.moody.hibernate.domain.CustManager;
import com.moody.hibernate.domain.CustOperation;
import com.moody.hibernate.domain.CustStockholder;
import com.moody.hibernate.domain.DebtInfo;
import com.moody.hibernate.domain.ExtratInfo;
import com.moody.hibernate.domain.GroupInfo;
import com.moody.hibernate.domain.IndBank;
import com.moody.hibernate.domain.IndInfo;
import com.moody.hibernate.domain.IndOccard;
import com.moody.hibernate.domain.IndOguarantee;
import com.moody.hibernate.domain.IndOloan;
import com.moody.hibernate.domain.MemberInfo;
import com.moody.hibernate.domain.PdH;
import com.moody.hibernate.domain.ReportData;
import com.moody.hibernate.domain.ReportList;
import com.moody.hibernate.domain.ReportListId;
import com.moody.hibernate.domain.SpecialRecord;
import com.moody.hibernate.domain.SpecialTrade;
/*
 * Copyright © Moody analytics
 *
 * @Author: Wang Fuqiang
 * @Time: 2011-8-30 下午04:42:54
 * @Modified by: Wangfuqiang 2011-09-07
 * @Description: 
 */
@Service
public interface CustomerService {
	public void insertAddress(CustAddress custAddress);
	
	public Boolean isCustExist(String custName, String custNo, String organizationID, String busiLicenseID);
	
	public void deleteAddressByCustId(String custId);
	
	public List<CustAddress> findAllByCustId(String custId);
	
	public List<CustManager> findManagerByCustId(String custId);
	
	public List<CustInfo> findAllByCustType(String custType,String userId, String orgId);
	
//	public List<CustInfo> findLimitCustByCustType(String custType, int start, int limit,String userId, String orgId);

	public CustInfo findCustByCustId(String custId);
	
	public CustInfo findCustByCustNo(String custNo);
	
	public CustInfo findCustAndCreditByCustId(String custId);

	public void insertGeneral(CustInfo custInfo);
	
	public void updateCustInfo(CustInfo custInfo);
	
	public void insertOperation(CustOperation custOpera);
	
//	public List<CustInfo> myCutomerList(String custType);
	
	public void insertCustManager(CustManager custManager);

	public void insertCustEvents(CustEvents custEvents);
	
	public void insertDeposit(BankCustDeposit bankCustDeposit);

	public List<CustEvents> findEventsByCustId(String custId);

	public void insertGuarantee(BankCustGuarantee bankCustGuarantee);

	public List<BankCustGuarantee> findGuaranteeByCustId(String custId);

	public List<BankCustDeposit> findDepositByCustId(String custId);

	public void insertLoan(BankCustLoan bankCustLoan);

	public List<BankCustLoan> findLoanByCustId(String custId);

	public void insertReport(ReportList reportList);
	
	public void deleteReport(ReportList reportList);

	public void insertReportData(ReportData rd);

	public void deleteCustomerById(String custId);
	
	//批量插入reportData
	public void insertReportDataList(List<ReportData> list);

	public Map findRecentReport(String custId);
	
	public List<ReportData> findRecentReportData(ReportList recentReport, String reportNo);
	
	public List<ReportData> findRecentReportData(ReportList recentReport);
	
	public List<ReportData> findFinancialIndexInCondition(String custId, String accountMonth);

	public void deleteAddressById(String addSerialNo);
	
	public CustAddress findAddressById(String addSerialNo);

	public void deleteManagerById(String addSerialNo);

	public void updateAddress(CustAddress custAddress);

	public CustManager findManagerById(String addSerialNo);


	public void deleteEventsById(String addSerialNo);


	public void updateManage(CustManager custManager);


	public CustEvents findEventsById(String serialNo);

	public BankCustDeposit findDepositById(String addSerialNo);



	public void updateEvent(CustEvents custEvent);

	public BankCustGuarantee findGuaranteeById(String serialNo);

	public void updateGuarantee(BankCustGuarantee bankCustGuarantee);

	public void deleteGuaranteeById(String serialNo);



	public void deleteDepositById(String addSerialNo);

	public void updateDeposit(BankCustDeposit bankCustDeposit);

	public BankCustLoan findLoanById(String addSerialNo);

	public void deleteLoanById(String addSerialNo);

	public void updateLoan(BankCustLoan bankCustLoan);

	public List<BankCustLoan> findLoanByCustIdAndType(String custId, String type);

	public List<BankCustDeposit> findDepositByCustIdAndType(String custId, String type);

	public List<ReportList> findReportListByCustId(String custId);

	public ReportList findReportListById(ReportListId reportId);

	public void updateReportList(ReportList reportList);

	public List<ReportData> findSortedEnterIncome(ReportList report);

	public List<ReportData> findSortedEnterAsset(ReportList report);

	public List<ReportData> findSortedEnterBalance(ReportList report);

	public List<ReportData> findSortedEnterDebt(ReportList report);
	
	public List<ReportData> findSortedFinanAsset(ReportList report);
	
	public List<ReportData> findSortedSmallBalance(ReportList report);

	public List<ReportData> findSortedSmallDebt(ReportList report);
	
	public List<ReportData> findSortedSmallAsset(ReportList report);

	public List<ReportData> findSortedFinanBalance(ReportList report);

	public List<ReportData> findSortedFinanDebt(ReportList report);
	
	public List<ReportData> findSortedFinanIncome(ReportList report);	
	
	public List<ReportData> findSortedFinanFinancialIndex(ReportList report);

	public List<ReportData> findSortedFinanFinancialIndexInput(ReportList report);
	
	public List<ExtratInfo> findExtratByCustId(String custId);

	public void insertExtrat(ExtratInfo extratInfo);

	public void deleteExtratById(String addSerialNo);

	public ExtratInfo findExtratById(String addSerialNo);

	public void updateExtrat(ExtratInfo extratInfo);

//	public List<CustInfo> findCustByCondition(String custType, String custName,String organizationID, String busiLicenseID);

	public boolean isReportReady(ReportList report);

	public void updateReportStatus(ReportList report, String status);

//	public List<CustInfo> findAllCustomerByUserId(String userId);

	public String getCustNameById(String debtCustId);
	
//	public List<CustInfo> findAllCustomer();

	public List<ReportData> findPreviousYearReportData(ReportList report);

	public List<ReportData> findSortedEnterCashFlow(ReportList report);

	public List<ReportData> findSortedSmallCashFlow(ReportList report);

//	public List<CustInfo> findCustomerByIdAndName(String condition, String keyword);

	public Map<String, Double> findRecentFIMapByCustId(String custId);

	public Map findRecentReportByCustId(String custId);
	
	public ReportList findReportByTime(String custId, String accountMonth);
	
	public List<String> findReportDate(String custId);

	public boolean isRetailCustExist(String custName, String custNo, String idtype, String idno);

	public void insertRetailGeneral(IndInfo custInfo);

	public IndInfo findIndCustByCustId(String custId);

	public void updateIndCustInfo(IndInfo custInfo);

	public IndOccard findIndOccardByCustId(String custId);

	public void updateIndOccardInfo(IndOccard custInfo);

	public void insertIndOccard(IndOccard custInfo);

	public IndOloan findIndOloanByCustId(String custId);

	public void insertIndOloan(IndOloan custInfo);

	public void updateIndOloanInfo(IndOloan custInfo);

	public List<IndOguarantee> findIndOguaranteeByCustId(String custId);

	public void insertIndOguarantee(IndOguarantee indOguarantee);

	public void deleteIndOguaranteeById(String addSerialNo);

	public void updateIndOguarantee(IndOguarantee indOguarantee);

	public IndOguarantee findIndOguaranteeById(String addSerialNo);

	public List<IndBank> findIndBankByCustId(String custId);

	public void insertIndBank(IndBank indBank);

	public void deleteIndBankById(String addSerialNo);

	public void updateIndBank(IndBank indBank);

	public IndBank findIndBankById(String addSerialNo);

	public List<SpecialTrade> findSpecialTradeByCustId(String custId);

	public void insertSpecialTrade(SpecialTrade specialTrade);

	public void deleteSpecialTradeById(String addSerialNo);

	public void updateSpecialTrade(SpecialTrade specialTrade);

	public SpecialTrade findSpecialTradeById(String addSerialNo);

	public List<SpecialRecord> findSpecialRecordByCustId(String custId);

	public void insertSpecialRecord(SpecialRecord specialRecord);

	public void deleteSpecialRecordById(String addSerialNo);

	public void updateSpecialRecord(SpecialRecord specialRecord);

	public SpecialRecord findSpecialRecordById(String addSerialNo);

	public PdH findIndNewestPDByCustId(String custId);

	public void updateIndPdH(PdH custInfo);

	public void insertIndPdH(PdH pdh);

	public List<PdH> findIndHistoryPDByCustId(String custId);

	public void deleteIndPDById(String addSerialNo);

	public PdH findIndPDById(String addSerialNo);

	public List<ReportData> findSortedPublicBalance(ReportList report);

	public List<ReportData> findSortedPublicAsset(ReportList report);

	public List<ReportData> findSortedPublicDebt(ReportList report);

	public List<ReportData> findSortedPublicRevenue(ReportList report);

	public List<ReportData> findSortedPublicExpend(ReportList report);

	public List<ReportData> findSortedPublicSurplus(ReportList report);

	public List<ReportData> findSortedPublicIncome(ReportList report);

	public List<ReportData> findSortedSmallIncome(ReportList report);

//	public List<CustInfo> findCustByCondition(String custType, String custName,String organizationId, String busiLicenseId, String custScope,String orgCode, String industryType, String creditLevel,String defaultStat,String exposureType, String classifyDate,String userId,String orgId);

	public List<CustInfo> findCustByCondition(Map<String,String> custInfoCondition,String userId,String orgId);
	
	public List<CustInfo> findCustByPdhCondition(Map<String,String> custInfoCondition,Map<String,String> pdhCondition,String userId,String orgId);
	
//	public List<CustInfo> findBiggestCustByCondition(String custType,String custScope, String exposureType,String orgCode, String industryType, String creditLevel,String defaultStat,String userId, String orgId);

	public List<GroupInfo> findGroupByCustId(String custId);

	public void insertGroup(GroupInfo groupInfo);

	public void deleteGroupById(String addSerialNo);

	public GroupInfo findGroupById(String addSerialNo);

	public void updateGroup(GroupInfo groupInfo);
	
	public List<MemberInfo> findMemberByCustId(String custId);

	public void insertMember(MemberInfo memberInfo);

	public void deleteMemberById(String addSerialNo);

	public MemberInfo findMemberById(String addSerialNo);

	public void updateMember(MemberInfo memberInfo);

//	public List<DebtInfo> findDebtByCondition(String custName,String custType, String custScope, String industryType, String exposureType, String orgCode,String debtNo, String debtName,String debtType, String guarantyKind, String classifyResult, String classifyDate);
	
	public List<DebtInfo> findDebtByCondition(Map<String,String> custCondition,Map<String,String> debtCondition,String userId,String orgId);

	public List<IndInfo> findAllIndCustomer(String userId, String orgId);

	public List<IndInfo> findIndCustomerByIdAndName(String condition,
			String keyword);

	public List<AssociateAccount> findAssociateAccountByCustId(String custId);

	public void insertAssociateAccount(AssociateAccount associateAccount);

	public AssociateAccount findAssociateAccountById(String addSerialNo);

	public void updateAssociateAccount(AssociateAccount associateAccount);

	public void deleteAssociateAccountById(String addSerialNo);
	
	public List<CustStockholder> findStockholderByCustId(String custId);

	public void insertCustStockholder(CustStockholder custStockholder);
	
	public CustStockholder findStockholderById(String addSerialNo);
	
	public void updateStockholder(CustStockholder custStockholder);
	
	public void deleteStockholderById(String addSerialNo);
	
	public Map<String, String> findReportDisplayName(String reportNo);
	
	public void updateBalance(String custId);

	public String getCustNameByCustNo(String debtCustId);

	public String getCustIdByCustNo(String debtCustId);

	public List<IndInfo> findIndCustByCondition(Map<String, String> condition,
			String userId, String orgId);
	
	public void sortByPDState(List<Map<String,Object>> list);
}
